<%@ Reference Control="~/Controls/UserMsgTabs.ascx" %>
<%@ Reference Control="~/Controls/PagingControl.ascx" %>
<%@ Register tagprefix="Pager" Tagname="DataGridPager" Src="Controls/PagingControl.ascx" %>
<%@ Register tagprefix="UserMsgTabs" Tagname="UserMsgTabs" Src="Controls/UserMsgTabs.ascx" %>
<%@ Page language="vb" EnableViewStateMac="true" Inherits="_2bMatesSite.messages_sent" CodeFile="messages_sent.aspx.vb" CodeFileBaseClass="_2bMatesSite.BaseWebPage" %>
<form id="Form1" method="post" runat="server">
	<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" height="100%">
		<tr>
			<td class="page_title" colspan="3"><asp:literal id="litMainPageTitle" runat="server">Messages - Sent</asp:literal></td>
		</tr>	
		<tr>
			<td valign="top" height="100%" class="main_table_border">
				<div class="content">
					<table cellSpacing="0" cellPadding="0" width="100%" border="0" class="main_text">
						<usermsgtabs:usermsgtabs id="ucTabs" runat="server"></usermsgtabs:usermsgtabs>
						<tr>
							<td class="small" height="15">&nbsp;</td>
						</tr>
						<tr>
							<td><asp:label id="lblNoMessages" runat="server" CssClass="main_text" Visible="False">There are no messages in this folder.</asp:label></td>
						</tr>
						<tr>
							<td>
								<asp:table id="tblMessages" runat="server" cellspacing=0 cellpadding=0 width=100%>
									<asp:TableRow VerticalAlign="Top">
										<asp:TableCell VerticalAlign="Top">
											<table border="0" cellpadding="0" cellspacing="0" width="100%">
												<tr>
													<td valign="middle"><PAGER:DATAGRIDPAGER id="dgPagerUp" runat="server"></PAGER:DATAGRIDPAGER></td>
												</tr>
												<tr>
													<td height="100%" valign="top"><!-- width="500px-->
														<ASP:DATAGRID id="dgMessagesSent" runat="server" AllowSorting="True" CellPadding="0" PagerStyle-HorizontalAlign="Right" PagerStyle-Mode="NumericPages" AllowCustomPaging="True" AllowPaging="True" Width="100%" GridLines="None" AutoGenerateColumns="False">
															<itemstyle cssclass="data_grid" verticalalign="Top"></ItemStyle>
															<headerstyle cssclass="data_grid_header"></HeaderStyle>
															<columns>
																<asp:TemplateColumn>
																	<headerstyle width="30px"></HeaderStyle>
																	<headertemplate>
																		<asp:CheckBox id="chkSelectAll" verticalalign="Top" onclick="javascript:SelectAll(this.checked, this.id);" runat="server" AutoPostBack="false" ToolTip="Select/Deselect All" onserverclick="chkSelectAll_CheckedChanged"></asp:CheckBox>
																	</HeaderTemplate>
																	<itemtemplate>
																		<asp:CheckBox id="chkSelect" runat="server" AutoPostBack="false" OnClick="javascript: SelectAll(this.checked, this.id);" value='<%# DataBinder.Eval(Container.DataItem, "MessageID") %>'>
																		</asp:CheckBox>
																	</ItemTemplate>
																	<footerstyle horizontalalign="Left" verticalalign="Top"></FooterStyle>
																</asp:TemplateColumn>
																<asp:BoundColumn DataField="Date" HeaderText="Date">
																	<headerstyle width="80px"></HeaderStyle>
																</asp:BoundColumn>
																<asp:TemplateColumn HeaderText="To">
																	<headerstyle width="160px"></HeaderStyle>
																	<itemstyle cssclass="data_grid_underline"></itemstyle>
																	<itemtemplate>
																		<%# DataBinder.Eval(Container.DataItem, "To") %>
																	</ItemTemplate>
																</asp:TemplateColumn>
																<asp:templatecolumn headertext="Type">
																	<headerstyle width="80px"></headerstyle>
																	<itemtemplate><asp:image id="imgType" runat="server" imageurl='<%# DataBinder.Eval(Container.DataItem, "TypeImageURL") %>' imagealign="AbsMiddle" tooltip='<%# DataBinder.Eval(Container.DataItem, "TypeName") %>'></asp:image></itemtemplate>
																</asp:templatecolumn>
																<asp:TemplateColumn HeaderText="Subject">
																	<headerstyle width="440px"></HeaderStyle>
																	<itemstyle cssclass="data_grid_underline"></itemstyle>
																	<itemtemplate>
																		<asp:HyperLink id="hlSubject" runat="server" NavigateURL='<%# DataBinder.Eval(Container.DataItem, "ViewMsgURL") %>'>
																			<%# DataBinder.Eval(Container.DataItem, "Subject") %>
																		</asp:HyperLink>
																	</ItemTemplate>
																</asp:TemplateColumn>
															</Columns>
															<pagerstyle verticalalign="Top" visible="False" horizontalalign="Right" mode="NumericPages"></PagerStyle>
														</ASP:DATAGRID>
													</td>
												</tr>
												<tr>
													<td valign="middle"><PAGER:DATAGRIDPAGER id="dgPager" runat="server"></PAGER:DATAGRIDPAGER></td>
												</tr>
												<tr>
													<td height="30"><br />
														<a id="lSelectAll" onclick="javascript: SelectAll(true, 'SelectAll');" href="#" class="main_text_bold" style="font-size:13px !important">Select All</a><font class="main_text_err" style="font-size:13px !important">&nbsp;|&nbsp;</font><a id="lClearAll" onclick="javascript: SelectAll(false, 'SelectAll');" href="#" class="main_text_bold" style="font-size:13px !important">Clear All</a><br />
													</td>
												</tr>
												<tr>
													<td><br /><asp:button id="btnDelete" runat="server" CssClass="btn" Text="Delete" CausesValidation="False" onmouseover="ButtonMouseOver(this);" onmouseout="ButtonMouseOut(this);" onclick="btnDelete_Click"></asp:button><br>&nbsp;<br></td>
												</tr>
											</table>
										</asp:TableCell>
									</asp:TableRow>
								</asp:table>
							</td>
						</tr>
					</table>
				</div>
			</td>
			<!-- BEGIN SKYSCRAPER ADVERTISEMENT -->	
			<!--
			<td class="small" width="10">&nbsp;</td>
			<td class="border_adv" vAlign="top" width="203" height="100%">
				<table cellSpacing="1" cellPadding="0" width="100%" border="0">
					<tr>
						<td class="small" width="10">&nbsp;</td>
						<td class="advertisement" width="193"><asp:Literal id="litSkyscraperAdvertisement" runat=server></asp:literal></td>
					</tr>
				</table>
			</td>-->
			<!-- END SKYSCRAPER ADVERTISEMENT -->	
		</tr>
	</table>
</form>
<script language="JavaScript">
function SelectAll(chkVal, idVal) 
{ 
    var frm = document.forms[0];
    
    // Loop through all elements
    for (i=0; i<frm.length; i++) 
    {
        
        // Look for our Header Template's Checkbox
        if (idVal.indexOf ('SelectAll') != -1) 
        {
            // Check if main checkbox is checked, then select or deselect datagrid checkboxes 
                frm.elements[i].checked = chkVal;
            // Work here with the Item Template's multiple checkboxes
        }
        else if(idVal.indexOf ('chkSelect') != -1)
        {
			if(!chkVal){
				frm.elements[3].checked = chkVal;
			}	
        }         
        else if (idVal.indexOf ('DeleteThis') != -1) 
        {
            // Check if any of the checkboxes are not checked, and then uncheck top select all checkbox
            if(frm.elements[i].checked == false) 
            {
                frm.elements[1].checked = false; //Uncheck main select all checkbox
            }
        }
    }

}
</script>

